package QLThongTinBanBe;
import java.io.*;

public class GhiDoc {
	String ten[] = new String[100000];
	String lop[] = new String[100000];
	String mail[] = new String[100000];
	String quequan[]= new String[10000];
	String masv[]=new String[100000];
	
		
	public GhiDoc(){
		for(int i=0;i<1000;i++)
		{
			masv[i]=new String("");
			ten[i] = new String("");
            lop[i] = new String("");
	        mail[i] = new String("");
	        quequan[i]=new String("");
	        
		}
	}
	//=============================================== GHI ====================================================
	//-----------------------------------------Ghi chuoi masv-------------------------------------------------
	public void ghi_masv(String masv){
		try {
		ObjectOutputStream oStream = new ObjectOutputStream(new FileOutputStream("CSDl/masv.txt"));	
		PrintWriter out = new PrintWriter(new FileOutputStream("CSDl/masv.txt"));
			out.print(masv);
			out.close();
		}
		catch (IOException e){
			 System.out.println(e.toString());}
		}
	//-----------------------------------------Ghi chuoi ten-------------------------------------------------
	public void ghi_ten(String ten){
		try {
		ObjectOutputStream oStream = new ObjectOutputStream(new FileOutputStream("CSDl/ten.txt"));	
		PrintWriter out = new PrintWriter(new FileOutputStream("CSDl/ten.txt"));
			out.print(ten);
			out.close();
		}
		catch (IOException e){
			 System.out.println(e.toString());}
		}
	//----------------------------------------Ghi chuoi sdt------------------------------------------------
	public void ghi_lop(String lop){
		try {
		ObjectOutputStream oStream = new ObjectOutputStream(new FileOutputStream("CSDl/lop.txt"));	
		PrintWriter out = new PrintWriter(new FileOutputStream("CSDl/lop.txt"));
			out.print(lop);
			out.close();
		}
		catch (IOException e){
			 System.out.println(e.toString());}
		}
	//--------------------------------------Ghi chuoi mail--------------------------------------------------
	public void ghi_mail(String mail){
		try {
		ObjectOutputStream oStream = new ObjectOutputStream(new FileOutputStream("CSDl/mail.txt"));	
		PrintWriter out = new PrintWriter(new FileOutputStream("CSDl/mail.txt"));
			out.print(mail);
			out.close();
		}
		catch (IOException e){
			 System.out.println(e.toString());}
		}
		//-----------------------------------------Ghi chuoi que quan-------------------------------------------------
	public void ghi_quequan(String quequan){
		try {
		ObjectOutputStream oStream = new ObjectOutputStream(new FileOutputStream("CSDl/quequan.txt"));	
		PrintWriter out = new PrintWriter(new FileOutputStream("CSDl/quequan.txt"));
			out.print(quequan);
			out.close();
		}
		catch (IOException e){
			 System.out.println(e.toString());}
		}
	//---------------------------------Ghi chuoi index------------------------------------------------------
	public void ghi_index(int index){
		String s=String.valueOf(index);
		try {
		ObjectOutputStream oStream = new ObjectOutputStream(new FileOutputStream("CSDl/index.txt"));	
		PrintWriter out = new PrintWriter(new FileOutputStream("CSDl/index.txt"));
			out.print(s);
			out.close();
		}
		catch (IOException e){
			 System.out.println(e.toString());}
		}
		
		
	 //================================================ DOC ===================================================	
	 //-------------------------------------------------Doc user-----------------------------------------------
	 public String doc_user(){
	 	String s="";
    	try {
    	     FileReader fr = new FileReader("CSDL/user.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null) 
   				    fr.close(); 				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
	 return s;
    }
    //---------------------------------------------------Doc password----------------------------------------
    public String doc_password(){
    	String s="";
    	try {
    	     FileReader fr = new FileReader("CSDL/password.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null)   
   				    fr.close();  				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
	 return s;
    }
     //---------------------------------------------------Doc masv----------------------------------------
   public void doc_masv(){
     	String s="";
     	int i=0;
    	try {
    	     FileReader fr = new FileReader("CSDL/masv.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null){
    					masv[i]=s;
    					i++;
    					}   
   				    fr.close();				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
    }
    //-------------------------------------------------Doc ten----------------------------------------------
    
     public void doc_ten(){
     	String s="";
     	int i=0;
    	try {
    	     FileReader fr = new FileReader("CSDL/ten.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null){
    					ten[i]=s;
    					i++;
    					}   
   				    fr.close();				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
    }
    //----------------------------------------------------Doc sdt---------------------------------------
     public void doc_lop(){
     	String s="";
     	int i=0;
    	try {
    	     FileReader fr = new FileReader("CSDL/lop.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null){
    					lop[i]=s;
    					i++;
    					}
   				    fr.close();   				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
    }
    //---------------------------------------------Doc mail--------------------------------------------
     public void doc_mail(){
     	String s="";
     	int i=0;
    	try {
    	     FileReader fr = new FileReader("CSDL/mail.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null){
    					mail[i]=s;
    					i++;
    					}  
   				    fr.close(); 				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
    }
    //---------------------------------------Doc que quan--------------------------------------------
    public void doc_quequan(){
     	String s="";
     	int i=0;
    	try {
    	     FileReader fr = new FileReader("CSDL/quequan.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null)
    				{
    					quequan[i]=s;
    					i++;
    					}   
   				    fr.close();				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
    }
    //---------------------------------------Doc index--------------------------------------------
     public int doc_index(){
     	String s="";
    	try {
    	     FileReader fr = new FileReader("CSDL/index.txt");
    	            BufferedReader nhan = new BufferedReader(fr);
    				while((s =nhan.readLine()) !=null)  
   				    fr.close();  				   
    	     }
       catch (IOException e){
			 System.out.println(e.toString());
			 }
	  return Integer.parseInt(s);
    }

}
